<?php

use yii\db\Migration;

/**
 * Class m180211_014902_add_columns_to_package
 */
class m180211_014902_add_columns_to_package extends Migration
{
    /**
     * @inheritdoc
     */
    public function safeUp()
    {
        $this->addColumn('package', 'price', $this->decimal(20, 2)->comment('当前卖方报价/预估售价（元）')->notNull());
        $this->addColumn('package', 'hushu_suit', $this->integer(10)->comment('已诉户数')->notNull());
        $this->addColumn('package', 'principle_suit', $this->decimal(20, 2)->comment('已诉本金')->notNull());
        $this->addColumn('package', 'percent_principle_suit', $this->decimal(5, 4)->comment('已诉本金占比')->notNull());
        $this->addColumn('package', 'discount', $this->decimal(5, 4)->comment('折扣率')->notNull());
        $this->addColumn('package', 'total_mortgage_principal', $this->decimal(20, 2)->comment('抵押金额（元）')->notNull());
        $this->addColumn('package', 'other_note', $this->text()->comment('其它补充')->notNull());

        $this->alterColumn('package', 'city', $this->string()->comment('城市'));
    }

    /**
     * @inheritdoc
     */
    public function safeDown()
    {
        echo "m180211_014902_add_columns_to_package cannot be reverted.\n";

        return false;
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m180211_014902_add_columns_to_package cannot be reverted.\n";

        return false;
    }
    */
}
